#include <string>
#include <algorithm>
#include <math.h>
#include <iostream>
using namespace std;
const static double m_PI = 3.14159265358979323846;

class CFigure
{
public:
    virtual string FigureType() = 0;
    virtual double Circumference() = 0;
    virtual double Area() = 0;
    virtual ~CFigure(){};
};

class CTriangle : public CFigure
{
public:
    CTriangle()
    {
        a = b = c = 0;
    }
    CTriangle(double a, double b, double c) : a(a), b(b), c(c) {}

    virtual string FigureType()
    {
        return "Triangle";
    }

    virtual double Circumference()
    {
        return a + b + c;
    }

    virtual double Area()
    {
        double s = Circumference() / 2;
        return sqrt(s * (s - a) * (s - b) * (s - c));
    }

private:
    double a, b, c;
};

class CSquare : public CFigure
{
public:
    CSquare()
    {
        a = b = 0;
    }
    CSquare(double a, double b) : a(a), b(b) {}

    virtual string FigureType()
    {
        return "Square";
    }

    virtual double Circumference()
    {
        return 2 * a + 2 * b;
    }

    virtual double Area()
    {
        return a * b;
    }

private:
    double a, b;
};

class CCircle : public CFigure
{
public:
    CCircle()
    {
        r = 0;
    }
    CCircle(double r) : r(r) {}

    virtual string FigureType()
    {
        return "Circle";
    }

    virtual double Circumference()
    {
        return 2 * r * m_PI;
    }

    virtual double Area()
    {
        return r * r * m_PI;
    }

private:
    double r;
};

int main(int argc, char *argv[])
{
    CFigure *figures[3];
    figures[0] = new CTriangle(2.1, 3.2, 4.3);
    figures[1] = new CSquare(5.4, 6.5);
    figures[2] = new CCircle(8.9);

    for (int i = 0; i < 3; i++)
    {
        cout << "Figure type:\t" << figures[i]->FigureType()
             << "\nCircumference:\t" << figures[i]->Circumference()
             << "\nArea:\t" << figures[i]->Area()
             << endl
             << endl;
    }
    return 0;
}